﻿using Efcore_Test.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Efcore_Test.Data.config
{
    public class OrderConfig : IEntityTypeConfiguration<Order>
    {
        public void Configure(EntityTypeBuilder<Order> builder)
        {
            builder.ToTable("T_Order");
            builder.HasOne(x => x.Delivery).WithOne(x => x.Order).HasForeignKey<Delivery>(x => x.OrderId); //1对1
        }
    }
}
